﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace DecisionFramework.Logging
{
    /// <summary>
    /// Provides app settings for the Logging mechanism.
    /// </summary>
    /// <remarks>
    /// Author: Greg Cowin
    /// </remarks>
    public class LoggingAppSettings
    {
        /// <summary>
        /// The company name such as Microsoft, Google, or Apple.
        /// </summary>
        public static string CompanyName
        {
            get
            {
                string name = ConfigurationManager.AppSettings["CompanyName"];
                if (name == null)
                    return "[Set 'CompanyName' in application settings]";
                return name;
            }
        }

        /// <summary>
        /// The name of the application, asp.net app, or services.
        /// </summary>
        public static string ContainerName
        {
            get
            {
                string name = ConfigurationManager.AppSettings["ContainerName"];
                if (name == null)
                    return "[Set 'ContainerName' in application settings]";
                return name;
            }
        }

        /// <summary>
        /// Whether to suppress severity of app events. In other words,
        /// if true, then all events will just be informational.
        /// </summary>
        public static bool IsSeveritySuppressed
        {
            get
            {
                string suppressed = ConfigurationManager.AppSettings["IsSeveritySuppressed"];
                if (!string.IsNullOrEmpty(suppressed) && suppressed.Equals("true", StringComparison.OrdinalIgnoreCase))
                    return true;
                return false;
            }
        }
    }
}
